package game;

import java.util.ArrayList;
import java.util.List;

public class Player {

    private int cash;
    private int stocks[];
    private List<Tile> tiles;
    private String name;
    private int index;
    private boolean human;
    private long userID;

    public Player(String name,long userID) {
        stocks = new int[7];
        this.cash = 0; 
        for (int i = 0; i < 7; i++) {
            stocks[i] = 0;
        }
        tiles = new ArrayList<Tile>();
        this.name = name;
        human = true; 
        this.userID = userID;
    }
    
    public long getUserID() {
    	return userID;
    }
    
    public void setNotHuman(){
    	human = false;
    }
    public boolean IsHuman(){
		return human;
	}
    
    public void setIndex(int index){
    	this.index = index;
    }
    
    public int getIndex(){
    	return index;
    }
    
    public int getCash() {
        return cash;
    }

    public void increaseCash(int money) {
        cash += money;
    }

    public void decreaseCash(int money) {
        cash -= money;
    }

    public String getName() {
        return name;
    }
    
    public String toString() {
        return name;
    }

    public int getCompanyStocks(enumCompany company) {
        return stocks[company.getIndex()];
    }

    public void increaseCompanyStock(enumCompany company, int amount) {
        stocks[company.getIndex()] += amount;

    }

    public void decreaseCompanyStock(enumCompany company, int amount) {
        stocks[company.getIndex()] -= amount;
    }

    public List<Tile> getTiles() {
        return tiles;
    }

    public void removeTile(Tile tileToRemove) {
        tiles.remove(tileToRemove);
    }

    public void addTile(Tile tileToAdd) {
        tiles.add(tileToAdd);
    }

}
